package com.ebookstore.dto;

import java.io.Serializable;

public class CartItem implements Serializable {

	private Item item;// 订单明细

	private int quantity;// 数量

	public Item getItem() {
		return item;
	}

	public void setItem(Item item) {
		this.item = item;
	}

	public int getQuantity() {
		return quantity;
	}

	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}

	// 获得当前明细的总价格
	public double getTotalPrice() {
		if (item != null) {
			return item.getBaseprice() * item.getDiscount() * quantity;
		} else {
			return 0;
		}
	}

	public void incrementQuantity() {
		quantity++;
	}

}
